package vn.co.thn.web.hotvideo.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import vn.co.thn.web.hotvideo.common.ControllerBase;
import vn.co.thn.web.hotvideo.data.jpa.Video;
import vn.co.thn.web.hotvideo.model.CategoryModel;
import vn.co.thn.web.hotvideo.model.VideoModel;

@SuppressWarnings("serial")
public class Play extends ControllerBase {
	private CategoryModel categoryModel = new CategoryModel();
	private VideoModel videoModel = new VideoModel();
	@Override
	protected void Get(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		Video video=videoModel.getObject(request.getParameter("code"));
		request.setAttribute("categorylist", categoryModel.getList());
		request.setAttribute("video_object", video);
		Forward("play");
		video.setViewcount(video.getViewcount()+1);
		videoModel.Update(video);
	}

	@Override
	protected void Post(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub

	}

}
